18 INFOR$=STRING$(200,0):DIR$=SPACE$(65):DRV_SET$=STRING$(26,0):FILENAME$=SPACE$(15):KAKUNO$=FILENAME$:PATH_ALL$=WC$:DUMMYY$=SPACE$(14):DUMMYP$="."+CHR$(0):FOR A=0 TO 256:FILE_NAME$(A)=SPACE$(16):NEXT:FOR A=0 TO 9:RADBUT$(A)=SPACE$(60):NEXT
140 LOCATE 0,6:M$="プレビューファイル ["+FDPF$+"]":YNM$=FDPF$:GOSUB *GETSTR:FDPF$=YNM$:CLS 3:IF RIGHT$(FDPF$,4)<>".PAT" THEN IF INSTR(FDPF$,".")=0 THEN FDPF$=FDPF$+".PAT" ELSE FDPF$=LEFT$(FDPF$,INSTR(FDPF$,"."))+"PAT"
150 LOCATE 0,6:M$="スキャンファイル ["+FDSF$+"]":YNM$=FDSF$:GOSUB *GETSTR:FDSF$=YNM$:CLS 3:IF RIGHT$(FDSF$,4)<>".TIF" THEN IF INSTR(FDSF$,".")=0 THEN FDSF$=FDSF$+".TIF" ELSE FDSF$=LEFT$(FDSF$,INSTR(FDSF$,"."))+"TIF"
160 'LOCATE 0,6:M$="デフォルトセーブファイル ["+DFD$+DFF$+"]":YNM$=DFD$+DFF$:GOSUB *GETSTR:IF INSTR(YNM$,":")=0 THEN DFF$=YNM$ ELSE YN=INSTR(YNM$,":"):DFD$=LEFT$(YNM$,YN):DFF$=RIGHT$(YNM$,LEN(YNM$)-YN)
1040 RESTORE 1110:FOR A=0 TO 2:READ CO%(A):NEXT:GOSUB *SET_DPI:DIM DPI%(MNDP):FOR A=0 TO MNDP:READ DPI%(A):NEXT
1050 RESTORE *N_DPI:FOR A=0 TO 5:READ COL$(A),COL%(A):NEXT:FOR A=0 TO 4:READ NOU$(A),NOU%(A):NEXT:FOR A=0 TO 3:READ MIDL$(A),MID%(A):NEXT
1060 FOR A=0 TO 3:READ OCM$(A),OCM%(A):NEXT:FOR A=0 TO 3:READ SCM$(A):NEXT:FOR A=0 TO 6:READ LUM$(A),LUM%(A):NEXT:FOR A=0 TO 7:FOR B=0 TO 3:READ IP%(A,B):NEXT:NEXT:FOR A=0 TO 2:READ PAL$(A):NEXT:GOTO 1220
2690 *MOUSE_GET:A=0:MMX=MOUSE(0)-MCX:MMY=MOUSE(1)-MCY:IF MOUSE(2,0)=0 THEN A$=INKEY$:IF A$=CHR$(13) OR A$=CHR$(24) THEN A=ASC(A$):RETURN ELSE *MOUSE_GET
2700 *MOUSE_CHK:WHILE MOUSE(6,0)=0:WEND:RETURN
3000 *MENU:IF PSCM<>1 THEN MCX=220:MCY=180 ELSE IF ZMFV=1 THEN MCX=156:MCY=68 ELSE MCX=60:MCY=60
3010 GET@A (MCX,MCY)-(MCX+199,MCY+119),G%
3020 *MENU_IN:GOSUB *PALETTE_INI:LINE (MCX,MCY)-(MCX+199,MCY+119),PSET,7,BF,1:A&=FRE(4):FOR A=0 TO 128:A$=INKEY$:NEXT
3520 SYMBOL (MCX+6,MCY+84),"Studio Aspergillus Valley",.85!,1,6,,,24:SYMBOL (MCX+44,MCY+102),"=OcToh[オクト]=",1,1,6,,,9:GET@A (MCX+3,MCY+17)-(MCX+110,MCY+34),GD%:FOR A=1 TO 10:Y=MCY+(17-A):PUT@A (MCX+3,Y)-(MCX+110,Y+17),GD%,PSET,1+A*.075!,1+A/10:NEXT
3530 CIRCLE (MCX+162,MCY+12),4,6,,,,F,,2:LINE (MCX+3,MCY+41)-(MCX+196,MCY+44),PSET,6,BF,2:RETURN
4000 *PREVIEW
4010 SYMBOL (MCX+4,MCY+22)," 仮読込を実行します。 ",1,1,4:SYMBOL (MCX+6,MCY+101)," 取消 実行",1,1,4:LINE (MCX+1,MCY+99)-(MCX+198,MCY+99),PSET,7:LINE (MCX+132,MCY+99)-(MCX+165,MCY+119),PSET,5,B,&H5555
4020 SYMBOL (MCX+126,MCY+79),"まびき",1,.5!,4:SYMBOL (MCX+102,MCY+89),"なし あ り",1,.5!,4:LINE (MCX+99,MCY+99)-(MCX+99,MCY+119),PSET,7
4030 GOSUB *MOUSE_GET:IF A=0 AND MMY<100 THEN 4030 ELSE IF MMX<99 OR A=24 THEN *MENU_IN
4040 IF A=0 THEN MABP=SGN((MMX-100)\33)+1:GOSUB 4080:CCOL=(MMX\166)*OCOL
4050 TY=1:DFO=1:MID=0:SZOMX=100/MABP:SZOMY=100/MABP:R1=50:R2=50:NOU=1:XST=0:YST=0:XEN=207:YEN=289:SCM=0:LUM=0:OCM=128:FPAL=1:PALM=0:IF MABP<2 THEN XEN=423:YEN=579:FPAL=0
5120 LINE (MCX+14,MCY+56)-(MCX+181,MCY+75),PSET,1,BF:LINE (MCX+4,MCY+24)-(MCX+195,MCY+43),PSET,2,BF,1:IF LEN(M$)<23 THEN SYMBOL (MCX+8,MCY+26),M$,1,1,4:RETURN ELSE SYMBOL (MCX+8,MCY+26),M$,.75!,1,4:RETURN
5430 FOR W=1 TO 4:A=MCY+2+20*W:LINE (MCX+2,A)-(MCX+198,A),PSET,3:NEXT:SYMBOL (MCX+38,MCY+105),"取消 実行",1,.8!,4:LINE (MCX+1,MCY+103)-(MCX+198,MCY+103),PSET,7:LINE (MCX+99,MCY+103)-(MCX+99,MCY+119),PSET,7
5440 FOR W=0 TO 4:A=MCY+3+20*W:LINE (MCX+52,A)-(MCX+197,A+18),PSET,6,BF,4:NEXT:FOR W=0 TO 4:A=MCY+3+20*W:LINE (MCX+62,A)-(MCX+187,A+18),PSET,6,BF,0:NEXT:LINE (MCX+2,MCY+2)-(MCX+198,MCY+102),PSET,3,B
5450 SYMBOL (MCX+54,MCY+99),"▲▲▲▲▲",1,.5!,2,1,,,4:SYMBOL (MCX+195,MCY+5),"▲▲▲▲▲",1,.5!,2,3,,,4
5460 CLP=0:FOR A=0 TO 5:IF COL%(A)=CCOL THEN CLP=A:NEXT ELSE NEXT
5470 LUMP=0:FOR A=0 TO 6:IF LUM%(A)=LUM THEN LUMP=A:NEXT ELSE NEXT
5480 NOUP=0:FOR A=0 TO 4:IF NOU%(A)=NOU THEN NOUP=A:NEXT ELSE NEXT
5490 MIDP=0:FOR A=0 TO 3:IF MID%(A)=MID THEN MIDP=A:NEXT ELSE NEXT
5500 OCMP=0:FOR A=0 TO 3:IF OCM%(A)=OCM THEN OCMP=A:NEXT ELSE NEXT
5520 GOSUB *MOUSE_GET:IF A>0 THEN IF A=13 THEN MMX=150:MMY=105 ELSE *MENU_IN
5530 IF MMY>103 THEN IF MMX>99 THEN CCOL=COL%(CLP):LUM=LUM%(LUMP):NOU=NOU%(NOUP):MID=MID%(MIDP):OCM=OCM%(OCMP):IF SCM=2 AND PALM=1 AND (CCOL=1 OR CCOL=2) THEN CCOL=0:GOTO *MENU_IN ELSE *MENU_IN ELSE *MENU_IN
5540 IF MMX<52 OR (MMX>62 AND MMX<187) THEN 5520
5550 IF MMY<22 THEN CMD=0:PX!=1:PCX=16:CMDP=CLP:CMDM=5:GOSUB 5610:CLP=CMDP:M$=COL$(CLP):GOTO 5600
5560 IF MMY<42 THEN CMD=1:PX!=1:PCX=0:CMDP=LUMP:CMDM=6:GOSUB 5610:LUMP=CMDP:M$=LUM$(LUMP):GOTO 5600
5570 IF MMY<62 THEN CMD=2:PX!=.9!:PCX=0:CMDP=NOUP:CMDM=4:GOSUB 5610:NOUP=CMDP:M$=NOU$(NOUP):GOTO 5600
5580 IF MMY<82 THEN CMD=3:PX!=1:PCX=8:CMDP=MIDP:CMDM=3:GOSUB 5610:MIDP=CMDP:M$=MIDL$(MIDP):GOTO 5600
5950 PRINT SPC(10);"G <";SPC(16);">":PRINT SPC(10);"R <";SPC(16);">":PRINT SPC(10);"B <";SPC(16);">":FOR A=0 TO 2:GOSUB 6040:NEXT:FOR A=3 TO 5:LINE (76,(PCY+A)*19-2)-(259,(PCY+A)*19+17),PSET,7,B:LINE(89,(PCY+A)*19-2)-(111,(PCY+A)*19+17),PSET,7,B
5960 LINE (239,(PCY+A)*19-2)-(239,(PCY+A)*19+17),PSET,7,B:NEXT:LINE (240,PCY*19+19)-(254,PCY*19+34),PSET,7:LINE (254,PCY*19+19)-(240,PCY*19+34),PSET,7:LINE (80,PCY*19+9)-(119,PCY*19+28),PSET,7,BF,%PCY:MOUSE 4,76,PCY*19+5,259,PCY*19+124
5970 WHILE MOUSE(2,0)=0:WEND:MMX=MOUSE(0):MMY=MOUSE(1):IF MMX>239 AND MMY>PCY*19+18 AND MMX<255 AND MMY<PCY*19+35 THEN WHILE MOUSE(6,0)=0:WEND:PUT@A (50,PCY*19+5)-(259,PCY*19+124),G%:GOSUB 6280:FOR A=0 TO 5:LOCATE 0,PCY+A:PRINT SPC(40);:NEXT:GOTO 5850
5980 IF MMX<76 OR MMX>259 OR MMY<(PCY+3)*19-2 OR MMY>(PCY+5)*19+17 THEN 5970 ELSE A=(MMY-PCY*19+2)\19-3:IF MMX<111 OR MMX>239 THEN GOSUB 6000:GOTO 5970
5990 B=(MMX-111)\8:GOSUB 6010:GOTO 5970
6000 GOSUB 6050:WHILE MOUSE(6,0)=0:WEND:BB=B:B=B+SGN(MMX-150):IF B>15 OR B<0 THEN B=BB
6010 ON A GOTO 6020,6030:PAL&(PCY)=(PAL&(PCY) AND 65535)+B*1048576:GOTO 6040
6020 PAL&(PCY)=(PAL&(PCY) AND 16711935)+B*4096:GOTO 6040
6030 PAL&(PCY)=(PAL&(PCY) AND 16776960)+B*16
6040 PALETTE PCY,[(PAL&(PCY) AND 16711680)\65536,(PAL&(PCY) AND 65280)\256,PAL&(PCY) AND 255]
6050 ON A GOTO 6060,6070:B=(PAL&(PCY) AND 16711680)\1048576:A$=SPACE$(16):MID$(A$,B+1)="|":LOCATE 14,PCY+3:PRINT A$:RETURN
6060 B=(PAL&(PCY) AND 65280)\4096:A$=SPACE$(16):MID$(A$,B+1)="|":LOCATE 14,PCY+4:PRINT A$:RETURN
6070 B=(PAL&(PCY) AND 255)\16:A$=SPACE$(16):MID$(A$,B+1)="|":LOCATE 14,PCY+5:PRINT A$:RETURN
6080 LOCATE 15,24:IF (SCM=2 AND PAL1<0) OR (SCM=0 AND PALM=0) THEN PRINT "OFF"; ELSE PRINT "ON ";
6090 LINE (13,455)-(146,472),PSET,2,B:RETURN
6100 LOCATE 43,23:COLOR 4:GOSUB 6110:LINE (246,454)-(385,454),PSET,6:LOCATE 4,23:IF SCM=0 OR PAL1=-1 THEN PRINT SPC(22);:LINE (30,454)-(209,454),PSET,6,BF,%7:COLOR 6:RETURN ELSE PRINT PAL$(PAL1);:COLOR 6:LINE (30,454)-(209,454),PSET,6:RETURN
6110 IF PAL1=0 AND SCM=2 THEN IF (PAL2 MOD 3)=0 THEN PRINT " 無し";:RETURN ELSE PRINT FNF$((PAL2 MOD 3)*8)+"色";:RETURN
6120 IF PAL2=0 THEN PRINT " 無し";:RETURN ELSE PRINT FNF$(PAL2)+"色";:RETURN
6130 LINE (639-PALX,PALY)-(640-PALX-PALL,PALY+PALL-1),XOR,7,B:RETURN
6140 CMD=0:IF MMX>411 AND MMX<484 THEN CMD=1 ELSE IF MMX>491 AND MMX<564 THEN CMD=2 ELSE IF MMX>571 AND MMX<628 THEN CMD=3
6150 IF CMD=0 THEN 5850 ELSE PCX=CMD*80+280:IF CMD=3 THEN 6180 ELSE GET@A (PCX,416)-(PCX+109,436),G%:LINE (PCX,416)-(PCX+109,436),PSET,3,BF,4:SYMBOL (PCX+12,418),"取消 実行",1,1,2,,,5:LINE (PCX+56,416)-(PCX+56,436),PSET,3
6160 MOUSE 1,PCX+30,425,1:MOUSE 4,PCX,416,PCX+109,436:GOSUB *MOUSE_GET:MMX=MMX+MCX:IF A>0 THEN MMX=60*SGN(24-A)+PCX
6170 GOSUB 6280:PUT@A (PCX,416)-(PCX+109,436),G%,PSET:MMX=MMX-PCX:IF MMX<56 THEN 5850 ELSE RETURN
6180 GET@A (PCX,332)-(PCX+109,437),G%:LINE (PCX,332)-(PCX+109,437),PSET,3,BF,4:RESTORE 6260:FOR A=0 TO 5:READ M$:IF PSCM=0 AND A=4 THEN M$="――――――"
6190 SYMBOL (PCX+4,334+17*A),M$,1,1,2,,,5:NEXT:MOUSE 1,PCX+30,425,1:MOUSE 4,PCX,334,PCX+109,435:CMD=9
6200 MMY=MOUSE(1):IF INKEY$=CHR$(24) THEN 6253 ELSE OCMD=CMD:CMD=(MMY-334)\17
6210 IF CMD<>OCMD THEN LINE (PCX,334+17*OCMD)-(PCX+109,349+17*OCMD),XOR,4,BF:LINE (PCX,334+17*CMD)-(PCX+109,349+17*CMD),XOR,4,BF
6220 IF MOUSE(2,0)=0 THEN 6200 ELSE WHILE MOUSE(6,0)=0:WEND:IF CMD=5 THEN 6253 ELSE IF CMD=4 THEN IF PSCM=0 THEN 6253 ELSE PAL1=0
6230 GOSUB *PALETTE_FIX:IF CMD=0 THEN IF PSCM=0 THEN PALM=0 ELSE PAL1=-1
6240 IF CMD>1 AND CMD<4 THEN IF PSCM=0 THEN PALM=1 ELSE IF PAL1<2 THEN PAL1=2
6350 IF MOUSE(2,0)=0 THEN I$=INKEY$:IF MOUSE(2,1) THEN SZOMX=OZMX:SZOMY=OZMY:GOTO 6340 ELSE IF I$=CHR$(13) OR I$=CHR$(24) THEN I=ASC(I$):MMX=100+50*SGN(24-I):GOTO 6510 ELSE 6350
6360 IF MOUSE(6,0)=0 THEN A=A+1 ELSE A=0
6370 MMX=MOUSE(0)-MCX:MMY=MOUSE(1)-MCY:IF MMY>72 THEN IF MMY<99 OR MMX<90 THEN A=0:GOTO 6350 ELSE 6510
6380 IF MMX<74 OR MMX>189 OR (MMX>106 AND MMX<157) THEN A=0:GOTO 6350
6390 ADP=SGN(MMX-120):IF A>10 THEN ADP=ADP*10
6400 IF MMY<37 THEN 6410 ELSE 6460
6410 IF MMX>90 AND MMX<173 THEN IF MMY>20 THEN GOSUB 6440:FOR W=0 TO 1000:NEXT:GOTO 6350 ELSE 6420 ELSE GOSUB 6440
6420 SR1P=R1P:R1P=R1P+SGN(ADP):IF R1P<0 OR R1P>MNDP THEN R1P=SR1P
6430 GOSUB 6520:FOR W=0 TO 1000:NEXT:GOTO 6350
6440 SR2P=R2P:R2P=R2P+SGN(ADP):IF R2P<0 OR R2P>MNDP THEN R2P=SR2P
6450 GOSUB 6530:RETURN
6460 IF MMX>90 AND MMX<173 THEN IF MMY>54 THEN GOSUB 6490:GOSUB 6560:GOTO 6350 ELSE 6470 ELSE GOSUB 6490
6470 SZOMX=SZOMX+ADP:IF SZOMX<50 THEN SZOMX=50 ELSE IF SZOMX>200 THEN SZOMX=200
6480 GOSUB 6540:GOSUB 6560:GOTO 6350
6490 SZOMY=SZOMY+ADP:IF SZOMY<50 THEN SZOMY=50 ELSE IF SZOMY>200 THEN SZOMY=200
6500 GOSUB 6550:RETURN
6510 IF MMX<145 THEN SZOMX=OZMX:SZOMY=OZMY:GOTO *MENU_IN ELSE R1=DPI%(R1P):R2=DPI%(R2P):GOTO *MENU_IN
6520 LINE (MCX+120,MCY+3)-(MCX+143,MCY+18),PSET,0,BF:SYMBOL (MCX+120,MCY+3),FNF$(DPI%(R1P)),1,1,4:GOSUB 6560:RETURN
6530 LINE (MCX+120,MCY+21)-(MCX+143,MCY+35),PSET,0,BF:SYMBOL (MCX+120,MCY+21),FNF$(DPI%(R2P)),1,1,4:GOSUB 6560:RETURN
6540 LINE (MCX+120,MCY+38)-(MCX+143,MCY+53),PSET,0,BF:SYMBOL (MCX+120,MCY+38),FNF$(SZOMX),1,1,4:RETURN
6550 LINE (MCX+120,MCY+55)-(MCX+143,MCY+70),PSET,0,BF:SYMBOL (MCX+120,MCY+55),FNF$(SZOMY),1,1,4:RETURN
6560 LINE (MCX+46,MCY+76)-(MCX+86,MCY+116),PSET,1,BF:RHI!=(SZOMY/SZOMX)*(DPI%(R2P)/DPI%(R1P)):IF RHI!>1 THEN RLN!=20/RHI! ELSE RLN!=20
6570 CIRCLE (MCX+66,MCY+96),RLN!,4,RHI!:LINE (MCX+128,MCY+83)-(MCX+197,MCY+98),PSET,1,BF:SYMBOL (MCX+130,MCY+83),FNF$(INT(SZOMX/OZMX*100))+" "+FNF$(INT(SZOMY/OZMY*100)),1,1,4:RETURN
6580 R1P=0:FOR A=0 TO MNDP:IF DPI%(A)=R1 THEN R1P=A:NEXT ELSE NEXT
6590 R2P=0:FOR A=0 TO MNDP:IF DPI%(A)=R2 THEN R2P=A:NEXT ELSE NEXT
6720 IF MOUSE(2,1) THEN GOSUB 7240:WHILE MOUSE(6,1)=0:WEND:XST=OOXST:YST=OOYST:XEN=OOXEN:YEN=OOYEN:ASS=OASS:ASM=OASM:ARS=OARS:ARM=OARM:GOSUB 7250
6730 I=0:LINE (ASS,ASM)-(ARS,ARM),XOR,7,B,&H0F0F:LINE (ASS,ASM)-(ARS,ARM),XOR,7,B:IF MOUSE(2,0) THEN A=MOUSE(6,0):OOXST=XST:OOYST=YST:OOXEN=XEN:OOYEN=YEN:OASS=ASS:OASM=ASM:OARS=ARS:OARM=ARM ELSE I$=INKEY$:IF I$="" THEN 6720 ELSE I=ASC(I$)
6740 GOSUB 7240:IF I>0 THEN MMX=510+50*SGN(24-I):GOTO 7220
6750 MMX=MOUSE(0):MMY=MOUSE(1):IF MMX>504 AND MMY>428 AND MMX<599 AND MMY<449 THEN 7220 ELSE IF MMX>ASS+DI OR MMX<ARS-DI OR MMY<ASM-DI OR MMY>ARM+DI THEN 6720 ELSE CMD=0
6760 IF MMX>ASS-DI THEN CMD=1:GOTO 6780
6770 IF MMX<ARS+DI THEN CMD=4
6780 IF MMY<ASM+DI THEN CMD=CMD+8:GOTO 6800
6790 IF MMY>ARM-DI THEN CMD=CMD+2
6800 IF CMD=0 THEN 7160 ELSE LNX=60:LNY=0:CPX=639:CPY=423
6810 IF CMD AND 1 THEN MMX=ASS:LNX=ARS:CPX=639:IF BDS*RSS!<CPX-LNX THEN CPX=BDS*RSS!+LNX
6820 IF CMD AND 2 THEN MMY=ARM:LNY=ASM:CPY=423:IF BDM*RSM!<CPY-LNY THEN CPY=BDM*RSM!+LNY
6830 IF CMD AND 4 THEN MMX=ARS:LNX=60:CPX=ASS:IF BDS*RSS!<CPX-LNX THEN LNX=CPX-BDS*RSS!
6840 IF CMD AND 8 THEN MMY=ASM:LNY=0:CPY=ARM:IF BDM*RSM!<CPY-LNY THEN LNY=CPY-BDM*RSM!
7020 IF CMD MOD 3=0 THEN RETURN ELSE MOUSE 4,0,0,639,479:GOSUB 6960:CPX=MOUSE(9):CPY=MOUSE(10):WHILE MOUSE(6,1)=0 AND MOUSE(6,0)=0:IF CMD=2 OR CMD=8 THEN 7080
7030 CPY=MOUSE(9):IF CPY=0 THEN 7130 ELSE IF CMD=4 THEN YEN=YEN-CPY ELSE YST=YST-CPY:YEN=YEN+CPY
7040 IF YST<0 THEN YST=0
7050 IF YEN>=BDS THEN YEN=BDS-1
7060 IF YST+YEN>MAY THEN IF YST>0 THEN YST=YST-1:GOTO 7060 ELSE YEN=YEN-1:GOTO 7060
7290 IF MOUSE(2,1) THEN WHILE MOUSE(6,1)=0:WEND:GOTO 7440
7300 IF MOUSE(2,0) THEN A=MOUSE(6,0) ELSE MMX=MOUSE(0):MMY=MOUSE(1):GOSUB *SCROLL_CHECK:GOTO 7290
7310 IF MMX>9 AND MMX<311 AND MMY>=MCY AND MMY<=MCY+36 THEN 7520
7320 IF SAF=0 THEN 7460 ELSE GOSUB 7510:CMD=0:IF NOT(MMX>FCX-DI AND MMX<FCX+XLEN+DI AND MMY<FCY+YLEN+DI AND MMY>FCY-DI) THEN 7460
7330 IF ABS(MMX-FCX)<DI THEN CMD=1 ELSE IF ABS(MMX-(FCX+XLEN-1))<DI THEN CMD=2
7340 IF ABS(MMY-FCY)<DI THEN CMD=CMD+4 ELSE IF ABS(MMY-(FCY+YLEN-1))<DI THEN CMD=CMD+8
7350 IF CMD=0 THEN GOSUB 7630:WHILE MOUSE(6,0)=0:FCX=MOUSE(0):FCY=MOUSE(1):GOSUB *SCROLL_CHECK_FC:FCX=FCX-LNX:FCY=FCY-LNY:GOSUB 7510:GOSUB 7710:GOSUB 7510:WEND:GOSUB 7510:SAF=1:MOUSE 4,0,0,MVX,MVY:GOTO 7290
7360 LNX=MMX:LNY=MMY:CPX=MMX:CPY=MMY:MMX=FCX+XLEN-1:MMY=FCY+YLEN-1:IF CMD AND 1 THEN LNX=0:CPX=MMX:MMX=FCX:FCX=CPX ELSE IF CMD AND 2 THEN LNX=FCX:CPX=MVX
7370 IF CMD AND 4 THEN LNY=0:CPY=MMY:MMY=FCY:FCY=CPY ELSE IF CMD AND 8 THEN LNY=FCY:CPY=MVY
7450 A=MOUSE(6,0):A&=CALLM(OFFSET&,8):GOSUB 7690:IF MOUSE(2,0)=0 AND (A& AND 16)<>16 THEN MMM=1-(MMM AND 1) ELSE MMM=MMM+2:IF MOUSE(2,0)<>0 THEN WHILE MOUSE(6,0)=0:WEND
8270 *SCREEN_MODE:A&=CALLM(OFFSET&,8):IF NOT((A& AND 20)<>0 AND SCM=1) AND PSCM=SCM THEN RETURN ELSE IF NOT(SCM=1) AND SCRLM=0 THEN 8307 ELSE IF (A& AND 20)=16 AND SCM=1 THEN SCRLM=1:GOTO 8277
8275 *SCREEN_MODE_IN:IF ZMFV<>0 THEN ON SCM+1 GOTO 8280,8295,8300
8290 IF NOT((A& AND 20)=4) THEN SCREEN@ 1:WINDOW (0,0)-(511,255):VIEW (0,0)-(511,255):PSCM=1:ZMFV=0:IF SCRLM=1 THEN IF MSF=0 THEN GOSUB *SM1:RETURN ELSE GOSUB *SM04:RETURN
8342 *MVSET02:A&=CALLM(OFFSET&,8):IF (A& AND 16)=16 THEN MVX=1023:MVY=511:RETURN ELSE MVX=639:MVY=511:RETURN
8345 *MVSET1:A&=CALLM(OFFSET&,8):IF (A& AND 16)=16 THEN MVX=511:MVY=255:RETURN ELSE MVX=319:MVY=255:RETURN
8350 *PALETTE_SET:IF PSCM=1 THEN RETURN ELSE PALETTE
8360 IF SCM=2 THEN 8370 ELSE *PALETTE_CHANGE
8370 ON PALM GOTO 8380,*PALETTE_CHANGE,*PALETTE_CHANGE:RETURN
8380 ON (CCOL\16)+1 GOSUB 8400,8410,8420,8430:GOSUB 8440:GOSUB *PALETTE_CHANGE:RETURN
8390 *PAL_PAL:OFPAL=FPAL:FPAL=PAL2 MOD 3:ON (CCOL\16)+1 GOSUB 8400,8410,8420,8430:GOSUB 8440:FPAL=OFPAL:RETURN
8400 FOR A=0 TO 255:PAL&(A)=A*65536+A*256+A:NEXT:RETURN
8410 FOR A=0 TO 255:PAL&(A)=A*256:NEXT:RETURN
8420 FOR A=0 TO 255:PAL&(A)=A*65536:NEXT:RETURN
8430 FOR A=0 TO 255:PAL&(A)=A:NEXT:RETURN
8440 ON FPAL GOTO 8450,8460:RETURN
8450 FOR A=0 TO 7:PAL&(A)=IP%(A,1)*65536+IP%(A,2)*256+IP%(A,3):NEXT:PAL&(8)=0:RETURN
8460 PAL&(0)=0:PAL&(8)=4210752:FOR A=1 TO 7:PAL&(A)=((IP%(A,1)+1)\2)*65536+((IP%(A,2)+1)\2)*256+((IP%(A,3)+1)\2):PAL&(A+8)=IP%(A,1)*65536+IP%(A,2)*256+IP%(A,3):NEXT:PAL&(16)=0:RETURN
8470 *PALETTE_CHANGE:IF SCM<>PSCM THEN RETURN
8480 ON SCM+1 GOTO 8500,8490,8510
8490 RETURN
8500 FOR A=0 TO 15:PALETTE A,[(PAL&(A) AND 16711680)\65536,(PAL&(A) AND 65280)\256,PAL&(A) AND 255]:NEXT:RETURN
8510 FOR A=0 TO 255:PALETTE A,[(PAL&(A) AND 16711680)\65536,(PAL&(A) AND 65280)\256,PAL&(A) AND 255]:NEXT:RETURN
8520 *PALETTE_INI:IF SCM<>PSCM THEN RETURN
8530 ON PSCM+1 GOTO 8550,8540,8560
8540 RETURN
8550 FOR A=0 TO 7:PALETTE A+SGN(A)*8,[IP%(A,1),IP%(A,2),IP%(A,3)]:NEXT:RETURN
8560 FOR A=0 TO 7:PALETTE IP%(A,0),[IP%(A,1),IP%(A,2),IP%(A,3)]:NEXT:RETURN
8570 *PALETTE_UNDO:IF SCM<>PSCM THEN RETURN
8580 ON PSCM+1 GOTO 8600,8590,8610
8590 RETURN
8600 FOR A=0 TO 7:B=A+SGN(A)*8:PALETTE B,[(PAL&(B) AND 16711680)\65536,(PAL&(B) AND 65280)\256,PAL&(B) AND 255]:NEXT:RETURN
8610 FOR A=0 TO 7:K=IP%(A,0):PALETTE K,[(PAL&(K) AND 16711680)\65536,(PAL&(K) AND 65280)\256,PAL&(K) AND 255]:NEXT:RETURN
8620 *PALETTE_SAVE:RETURN
8630 *PALETTE_LOAD:PS$=DFD$+DFF$
8640 *PALETTE_LOAD_IN:GOSUB *CHECK_TAG6:CLOSE:IF YN=0 THEN PS$=LEFT$(PS$,LEN(PS$)-4)+".PLT":ON ERROR GOTO 8760:IF SCM<>1 THEN 8730
8720 ON ERROR GOTO 0:RETURN
8730 OPEN "I",#1,PS$:A!=CVL(INPUT$(4,1)):CLOSE:IF HEX$(A!)="F0000000" THEN *PALETTE_PALETTE ELSE ON SCM+1 GOTO 8740,8720,8750
8740 OPEN "I",#1,PS$:FOR A=0 TO 15:PAL&(A)=CVL(INPUT$(4,1)):NEXT:CLOSE:IF PALM=0 THEN PALM=1:RETURN ELSE RETURN
8750 LOAD@ PS$,PAL&:IF PALM=0 THEN PALM=1:RETURN ELSE RETURN
8760 IF ERR=63 THEN GOSUB *PALETTE_PALETTE:RESUME 8720
8770 PRINT "Error ";ERR;" in ";ERL:CALLM RCLOSE&,PIT&:END
8790 PAL&(0)=0:IF PSCM=0 THEN PAL&(7)=8421504:PAL&(15)=16777215:RETURN
8800 PAL&(182)=12566463:PAL&(255)=16777215:RETURN
8810 IF PSCM=0 THEN GOSUB *PALETTE_PALETTE:RETURN
8820 RESTORE 9010:FOR A=1 TO 6:READ BY&(A):NEXT:FOR A=0 TO 31:A!=263172*A:GOSUB 8880:PAL&(A)=A!:A!=263172*A:GOSUB 8880:PAL&(255-A)=A!:NEXT:FOR B=1 TO 6:FOR A=0 TO 31:A!=BY&(B)*((31-A)*8+7):GOSUB 8880:PAL&(B*32+A)=A!:NEXT:NEXT
8830 FOR A=0 TO 31:A!=8618883+263172*A:GOSUB 8880:PAL&(224+A)=A!:NEXT:RETURN
8840 IF PSCM=0 THEN GOSUB *PALETTE_PALETTE_IN:FOR A=1 TO 7:SWAP PAL&(A),PAL&(A+8):NEXT:RETURN
8850 RESTORE 9010:FOR A=1 TO 6:READ BY&(A):NEXT:FOR A=0 TO 31 STEP 2:FOR B=1 TO 6:A!=BY&(B)*((31-(A\2))*8+7):GOSUB 8880:PAL&(A*8+B)=A!:A!=BY&(B)*((15-(A\2))*8+7):GOSUB 8880:PAL&((A+1)*8+B)=A!:NEXT:NEXT
8860 FOR A=0 TO 31 STEP 2:A!=263172*(A\2):GOSUB 8880:PAL&(A*8)=A!:A!=263172*(16+(A\2)):GOSUB 8880:PAL&((A+1)*8)=A!:A!=16777215-263172*(A\2):GOSUB 8880:PAL&(A*8+7)=A!:A!=16777215-263172*(16+(A\2)):GOSUB 8880:PAL&((A+1)*8+7)=A!:NEXT:RETURN
8870 GOSUB *PAL_PAL:RETURN
8880 IF A!>=2147483648# THEN A!=A!-4294967296#
8890 RETURN
8900 SCREEN@ 0:CLS:PALETTE:FOR A=0 TO 255:PRINT USING "### : [G : ### R : ### B : ### ]";A;(PAL&(A) AND 16711680)\65536;(PAL&(A) AND 65280)\256;PAL&(A) AND 255:A$=INPUT$(1):NEXT:CALLM RCLOSE&,PIT&:END
8910 SCREEN@ 0:CLS:PALETTE:A#=8421504:PRINT USING "[G : ### R : ### B : ### ]";(A# AND 16711680)\65536;(A# AND 65280)\256;A# AND 255:A$=INPUT$(1):CALLM RCLOSE&,PIT&:END
8970 GOSUB *INI256:RESTORE 8990:FOR A=0 TO 15:READ PAL&(A):NEXT:A&=16:RETURN
8980 *INI256:A=0:FOR G=0 TO 7:FOR R=0 TO 7:FOR B=0 TO 3:PAL&(A)=(G*32+31*SGN(G))*65536+(R*32+31*SGN(R))*256+(B*64+63*SGN(B)):A=A+1:NEXT:NEXT:NEXT:A&=256:RETURN
8990 DATA 0,128,32768,32896,8388608,8388736,8421376,8421504,4210752,255,65280,65535,16711680,16711935,16776960,16777215
9000 DATA 8158332,255,65280,65535,16711680,16711935,16776960,16777215, 263172,7,1792,1799,458752,458759,460544,263172
63430 IF KTYPE(FDMT$,1)=1 AND POS(0)=FDX+37 THEN PRINT " ";
63440 IF POS(0)>FDX+37 THEN LOCATE FDX+4,FDY+17:IF LEN(FDMT$)>34 THEN IF KTYPE(FDMT$,KLEN(FDMT$))=1 THEN FDMT$=KLEFT$(FDMT$,KLEN(FDMT$)-1) ELSE FDMT$=LEFT$(FDMT$,34)
63450 PRINT KLEFT$(FDMT$,1);:IF LEN(FDMT$)<>0 THEN FDMT$=KRIGHT$(FDMT$,KLEN(FDMT$)-1)